<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // window.alert(111)

        // document.getElementById()

        // var flag = confirm('确定要删除吗？')
        // console.log(flag)

        window.onload = function(){
            document.getElementById('btn1').onclick = function(){
                open('http://www.baidu.com')
            }
        }

        var timer;
        function doStart(){
            // setTimeout(function(){
            timer = setInterval(function(){
                console.log(111)
            }, 2000) // 单位毫秒，1000毫秒等于1秒
        }

        function doStop(){
            clearInterval(timer)
            console.log('计时器停止了。。。。')
        }
    </script>
</head>
<body>
    <button id="btn1">按钮1</button>
    <button onclick="doStart()">开始</button>
    <button onclick="doStop()">停止</button>
</body>
</html>